package com.wltt.product.ahuthr.controller;

import com.wltt.product.ahuthr.model.ResultData;
import com.wltt.product.ahuthr.model.vo.*;
import com.wltt.product.ahuthr.service.SalaryService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/api/salary")
public class SalaryController {

    @Resource
    private SalaryService salaryService;

    /**
     * 分页查询人员薪资
     *
     * @return
     */
    @PostMapping(value = {"/listUserSalary"})
    public ResultData listUserSalary(@RequestBody ListUserSalaryReq listUserSalaryReq) {
        return salaryService.listUserSalary(listUserSalaryReq);
    }

    /**
     * 导出
     *
     * @return
     */
    @GetMapping(value = {"/exportSalary"})
    public void exportSalary(HttpServletResponse response) {
        salaryService.exportSalary(response);
    }

    /**
     * 分页查询未起薪人员
     *
     * @return
     */
    @PostMapping(value = {"/listUserNoSalary"})
    public ResultData listUserNoSalary(@RequestBody ListUserNoSalaryReq listUserNoSalaryReq) {
        return salaryService.listUserNoSalary(listUserNoSalaryReq);
    }

    /**
     * 薪资详情
     *
     * @return
     */
    @PostMapping(value = {"/salaryDetail"})
    public ResultData salaryDetail(@RequestBody SalaryDetailReq salaryDetailReq) {
        return salaryService.salaryDetail(salaryDetailReq);
    }

    /**
     * 计算薪资
     *
     * @return
     */
    @PostMapping(value = {"/calculateSalary"})
    public ResultData calculateSalary(@RequestBody CalculateSalaryReq calculateSalaryReq) {
        return salaryService.calculateSalary(calculateSalaryReq);
    }

    /**
     * 计算公积金
     *
     * @return
     */
    @PostMapping(value = {"/calculateHouseFunds"})
    public ResultData calculateHouseFunds(@RequestBody CalculateHouseFundsReq calculateHouseFundsReq) {
        return salaryService.calculateHouseFunds(calculateHouseFundsReq);
    }

    /**
     * 计算社保
     *
     * @return
     */
    @PostMapping(value = {"/calculateInsurance"})
    public ResultData calculateInsurance(@RequestBody CalculateInsuranceReq calculateInsuranceReq) {
        return salaryService.calculateInsurance(calculateInsuranceReq);
    }

    /**
     * 更新薪资
     *
     * @return
     */
    @PostMapping(value = {"/updateSalary"})
    public ResultData updateSalary(@RequestBody UpdateSalaryReq updateSalaryReq) {
        return salaryService.updateSalary(updateSalaryReq);
    }

    /**
     * 新增薪资
     *
     * @return
     */
    @PostMapping(value = {"/addSalary"})
    public ResultData addSalary(@RequestBody AddSalaryReq addSalaryReq) {
        return salaryService.addSalary(addSalaryReq);
    }

    /**
     * 定薪
     *
     * @return
     */
    @PostMapping(value = {"/makeSalary"})
    public ResultData makeSalary(@RequestBody MakeSalaryReq makeSalaryReq) {
        return salaryService.makeSalary(makeSalaryReq);
    }

    /**
     * 复核定薪
     *
     * @return
     */
    @PostMapping(value = {"/recheckSalary"})
    public ResultData recheckSalary(@RequestBody RecheckSalaryReq recheckSalaryReq) {
        return salaryService.recheckSalary(recheckSalaryReq);
    }
}
